import QtQuick 2.6
import Sailfish.Silica 1.0
import "../config"
import "../component"

Item {
    id: personPage
    width: parent.width
    height: parent.height


    property real itemSpa: 20
    property int componentPadding: 40

    Column {
        id: mainColumn
        spacing: 20
        width: parent.width-componentPadding
        height: parent.height-componentPadding
        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter


        // 设置、明暗模式按钮区域
        Row {
            id: topRow
            width: parent.width
            height: themeIcon.height
            spacing: 30


            Icon{
                id:themeIcon
                width: 80
                height: 80
                source: AppColor.themeModeIndex===0?"../img/icon_theme_light.svg":AppColor.themeModeIndex===1?"../img/icon_theme_dark.svg":"../img/icon_theme_jolla.svg"
                color: AppColor.themeMode.primaryColor
                anchors.left: parent.left
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        var index = AppColor.themeModeIndex + 1
                        AppColor.changeThemeMode(index%3)
                    }
                }
            }


            Icon {
                id: settingIcon
                source: "../img/icon_setting.svg"
                width: 80
                height: 80
                color: AppColor.themeMode.primaryColor
                anchors.right: parent.right
                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        pageStack.animatorPush(Qt.resolvedUrl("SettingPage.qml"),
                                                                       {}, PageStackAction.Immediate)
                    }
                }
            }

        }

        //今日阅读
        Rectangle{
            height: todayReadBlock.height+componentPadding
            width: parent.width
            radius: 20
            color: AppColor.themeMode.primaryComponentColor

            UIDualLabel {
                id: todayReadBlock
                title: qsTr("今日阅读")
                value: qsTr("50小时")

                MouseArea{
                    anchors.fill: parent
                    onClicked: {
                        pageStack.animatorPush(Qt.resolvedUrl("ReadTimePage.qml"),
                                                                       {}, PageStackAction.Immediate)
                    }
                }
            }

        }



        Item {
            width: parent.width
            height: componentPadding/4
        }


        //联系我们与关于
        Rectangle{
            height: aboutBlock.implicitHeight+componentPadding
            width: parent.width
            radius: 20
            color: AppColor.themeMode.primaryComponentColor
            clip: true

            Column{
                id:aboutBlock
                width: parent.width
                height: children.implicitHeight
                anchors.verticalCenter: parent.verticalCenter

                UIDualLabel {
                    id: timeLine
                    title: qsTr("时间轴")
                }

                UIDualLabel {
                    id: about
                    title: qsTr("关于")

                    MouseArea{
                        anchors.fill: parent
                        onClicked: pageStack.animatorPush(Qt.resolvedUrl("AppInfoPage.qml"),{}, PageStackAction.Immediate)
                    }
                }
            }

        }


    }
}
